package com.ws.service.serviceImpl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.ws.bean.Vehicle;
import com.ws.bean.VehicoleBrand;
import com.ws.dao.VehicleBrandDao;
import com.ws.service.VehicleBrandService;
import com.ws.util.Page;
@Service
public class VehicleBrandServiceImpl implements VehicleBrandService {

	@Autowired
	VehicleBrandDao dao;
	@Override
	public List<VehicoleBrand> getBrands(VehicoleBrand brand, Page page) {
		return dao.getBrands(brand,page);
	}
	@Override
	public int getCount(VehicoleBrand brand) {
		return dao.getCount(brand);
	}
	@Override
	public int addBrand(VehicoleBrand brand) {
		return dao.addBrand(brand);
	}
	@Override
	public int editBrand(VehicoleBrand brand) {
		return dao.editBrand(brand);
	}
	@Override
	public int delBrand(Integer id) {
		List<Vehicle> list = dao.getVehicles(id);
		if(list.size() == 0) {
			return dao.delBrand(id);
		}else {
			return -1;
		}
		
	}

}
